Skip to content

knowledge: kubelet resource-metrics, PID1 log flush, date %3N detection#4

Open
dch0202-rsquare wants to merge 2 commits into
choiyounggi:mainfrom
dch0202-rsquare:knowledge/dch0202-rsquare-20260715-150902
Open

knowledge: kubelet resource-metrics, PID1 log flush, date %3N detection#4
dch0202-rsquare wants to merge 2 commits into
choiyounggi:mainfrom
dch0202-rsquare:knowledge/dch0202-rsquare-20260715-150902

Conversation

@dch0202-rsquare

Copy link
Copy Markdown

Knowledge flush — 3 insight(s)

Drained 3 queued ★ Insight candidates. Each was independently researched and
verified against primary sources before ingest. Two new pages created, one
existing page extended. No auto-merge — this PR is for review.

Cross-Check: each of the 3 candidates was verified by an independent research
subagent against primary sources (chart values.yaml / k8s docs / kubernetes-mixin;
Greg's Wiki + pipe(7) + Docker/bash manuals; GNU + FreeBSD date + POSIX strftime).
All three mechanisms VERIFIED; corrections folded in (mixin also pins
job=cadvisor not just image!=""; process-sub $! is bash 4.4+ not 5.1) and
field-observed specifics (OrbStack root cause, literal 3N) labeled as such.

Verified best-practice

1. Empty cAdvisor container_* metrics on a lightweight kubelet → scrape /metrics/resource

2. Container PID 1 entrypoint loses piped logs on exit → wait for tee in an EXIT trap

3. Feature-detect date +%3N by 3-digit output, not by %N support

  • Claim: Detecting GNU vs BSD date by "does %N work" is wrong because modern
    macOS supports %N; check that date +%3N outputs three digits.
  • Sources checked (real):
  • Verification result: core advice VERIFIED and strengthened — modern macOS returns real nanoseconds for %N, making it an even worse discriminator than the candidate claimed. Two specifics are field-observed: the exact %3N → literal 3N output (consistent with POSIX "undefined", not documented as 3N), and GNU %3N = "first 3 digits" (width mechanism documented; the truncation semantics universally relied on but not spelled out). The page frames 3N as field-observed.
  • Confidence: verified (recommendation robust; two specifics noted as field-observed).

Existing-layer check

  • Read all infrastructure/observability/ pages (logs-metrics-signals,
    alerting) and all infrastructure/containers/ pages (image-builds,
    resource-limits-and-probes), plus platforms/tools/bsd-vs-gnu-cli,
    platforms/shells/portable-shell-scripts, platforms/environment/timezone-and-locale.
  • knowledge: streaming large result sets (server-side cursor blocked → fetchmany + write-only) #1 (kubelet metrics): logs-metrics-signals covers what/how to instrument
    (signal choice, cardinality, golden signals) — a different trigger from "a
    specific series is empty despite a healthy scrape." Merging would blur that
    page's focus, so created a new page and cross-linked both ways
    (related:). No conflict.
  • knowledge: kubelet resource metrics on embedded k8s; host-to-pod memory limit sizing #2 (PID 1 tee): the decisive trigger condition is container PID 1, not OS
    portability, so it does not belong in platforms/shells/portable-shell-scripts
    (which already covers process substitution/set -e/EXIT traps for the
    portability case). Created a new page under infrastructure/containers
    (owns the PID 1 lifecycle artifact) and added a related: link both ways to
    the shell page. No conflict.
  • knowledge: PID-1 tee log capture pattern, BSD/GNU date %3N feature detection #3 (date %3N): directly overlaps the existing date guidance in
    bsd-vs-gnu-climerged (one Do-table row + one Instead-of row + two
    sources + last_verified bump). No new page. No conflict with the existing
    "Relative date" row (distinct sub-case).

Routing decision

Insight Target Action
#1 kubelet resource metrics infrastructure/observability/kubelet-resource-metrics.md (new page) Created; registered in infrastructure/index.md observability table; related:logs-metrics-signals
#2 PID 1 tee log flush infrastructure/containers/pid1-entrypoint-log-flush.md (new page) Created; registered in infrastructure/index.md containers table; related:portable-shell-scripts, → resource-limits-and-probes, logs-metrics-signals
#3 date +%3N detection platforms/tools/bsd-vs-gnu-cli.md (existing) Merged one Do-row + one Instead-of row; added GNU date + POSIX strftime sources; last_verified → 2026-07-15

No new category was needed — both new pages fit existing categories
(infrastructure/observability, infrastructure/containers). log.md has three
appended entries (2× ingest, 1× revise).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant